package com.wc.alorithm_luogu.P4715;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.LinkedList;

/**
 * @Author congge
 * @Date 2023/5/21 21:33
 * @description https://www.luogu.com.cn/problem/P4715
 * 【深基16.例1】淘汰赛
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = (int) Math.pow(2, sc.nextInt());

        LinkedList<Integer> array = new LinkedList<>();

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int capacity = sc.nextInt();
            array.add(capacity);
            map.put(capacity, i + 1);
        }
        int size = n;
        while (size != 2) {
            size /= 2;
            int i = 0;
            while (i < size) {
                if (array.get(i) < array.get(i + 1)) {
                    array.remove(i);
                } else {
                    array.remove(i + 1);
                }
                i++;
            }
        }

        System.out.println(map.get(Math.min(array.get(0), array.get(1))));
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
